package com.ohc.leetcode.链表;

/**
 * 2022年6月17日10:07:13
 */
public class 二进制链表转整数1290 {

    public static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public static int getDecimalValue(ListNode head) {
        String str = "";
        while (head != null) {
            str += head.val;
            head = head.next;
        }


        return Integer.valueOf(str, 2);
    }

    public static void main(String[] args) {
//        getDecimalValue();
    }
}
